import lejos.nxt.*;


public class ReadSensors extends Thread{
	
	
	private DistanceMonitor frontMonitor;
	private DistanceMonitor rearMonitor;
	private DistanceMonitor sideMonitor;

	public ReadSensors(DistanceMonitor frontMonitor,
			DistanceMonitor rearMonitor, DistanceMonitor sideMonitor) {
		this.frontMonitor = frontMonitor;
		this.rearMonitor = rearMonitor;
		this.sideMonitor = sideMonitor;
	}
	
	
	public void run() {
		while (true) {
			if (Button.ENTER.isPressed()) {
				LCD.clear();
				System.out.println("TACHO: " + Motor.A.getTachoCount());
				System.out.println("front: " + frontMonitor.getDistance());
				System.out.println("rear: " + rearMonitor.getDistance());
				System.out.println("side: " + sideMonitor.getDistance());
			}
			if (Button.ESCAPE.isPressed()) {
				System.exit(0);
			}
		}
	}
}
